namespace Stee.CAP8.MessageBus.Sagas.Order
{
    using Microsoft.Extensions.DependencyInjection;
    using Stee.CAP8.MessageBus.Sagas.Core.Extensions;
    using Stee.CAP8.MessageBus.Sagas.Core.Sagas;
    using Stee.CAP8.MessageBus.Sagas.Order.Sagas.Data;
    using Stee.CAP8.MessageBus.Sagas.Order.Services;
    using Stee.CAP8.MessageBus.Sagas.Payment.Dtos;
    using System;

    class Program
    {
        private static void Main(string[] args)
        {
            var services = new ServiceCollection()
                .AddSingleton(typeof(IOrderService), typeof(OrderService))
                .AddSagaMiddleware()
                .UseSaga(bus => bus.HandleEvent());

            var orderService = services.BuildServiceProvider().GetService<IOrderService>();
            while (true)
            {
                Console.ReadLine();
                _ = orderService.CreateOrder(new System.Collections.Generic.List<ProductInfo>
                {
                    new ProductInfo{Count=1,ProductId=Guid.NewGuid(),ProductName="",TotalPrice=22},
                    new ProductInfo{Count=2,ProductId=Guid.NewGuid(),ProductName="",TotalPrice=33},
                });

            }

        }
    }
}
